﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarSimulate
{
    internal class CarInLineStruct
    {
        public PointF CurrentPoint { get; set; }
        public PointF LastPoint { get; set; }
        public bool AbsInLine { get; set; } = false;
        public double CurrentLineRank { get => m_currentLineRank; set => m_currentLineRank = value; }
        public bool NeedFindNextPath { get; internal set; }
        public double LeftDistanceToGo { get; internal set; }

        private double m_currentLineRank = 0;

        internal void Save()
        {
            LastPoint = CurrentPoint;
        }

        internal void Slow(double v)
        {
            var cpx = (CurrentPoint.X - LastPoint.X) * v + LastPoint.X;
            var cpy = (CurrentPoint.Y - LastPoint.Y) * v + LastPoint.Y;
            CurrentPoint = new PointF((float)cpx, (float)cpy);
        }
        /*CurrentLineRank = CalculateRmd(CurrentPoint, CurrentLine.StartPoint, CurrentLine.EndPoint);
*  CurrentPoint = CurrentLineRank = CalculateRmd(CurrentPoint, CurrentLine.StartPoint, CurrentLine.EndPoint);*/
    }
}
